import Vue from 'vue'

import Vuex from 'vuex'
import persistedState from "vuex-persistedstate"
Vue.use(Vuex)

const store = new Vuex.Store({
	plugins: [
			persistedState({
				storage: {
					getItem: key => uni.getStorageSync(key),
					setItem: (key, value) => uni.setStorageSync(key, value),
					removeItem: key => uni.removeStorageSync(key)
				}
			})
		],

    state: {
		//公共的变量，这里的变量不能随便修改，只能通过触发mutations的方法才能改变
		isLoading:false,
		mackNum2:0,
		mackNum1:0,
		mackNum:0,
		mackNum30:0,
		Show0:false,
		Show:false,
		Show1:false,
		Show2:true,
		Show3:false,
		Show4:false,
		num: -1,
		num1: 0,
		num2: -1
		
	},
    mutations: {
			closemackNum(state){
				state.mackNum2=0
				state.mackNum1=0
				state.mackNum=0
				state.mackNum30=0
			},
			openTCdeng(state){
				state.mackNum1=3;
				state.mackNum=3;
			},
			closeTCdeng(state) {
				state.mackNum1=0;
				state.mackNum=0;
				// console.log(1);
				// state.Show=false
				// console.log(state.Show);
			},
			openTCxun(state) {
				state.mackNum2=3;
				// console.log(1);
				// state.Show=false
				// console.log(state.Show);
			},
			closeTCxun(state) {
				state.mackNum2=0;
				// console.log(1);
				// state.Show=false
				// console.log(state.Show);
			},
			openTC(state){
				state.mackNum=3;
				state.mackNum30=3;
				state.Show=true
				// console.log(state.mackNum);
			},
			openTC1(state){
				state.mackNum=3;
				state.Show1=true
			},
			openTC2(state){
				state.mackNum=3;
				state.Show2=true
				console.log(11);
			},
			openTC3(state){
				state.mackNum=3;
				state.Show3=true
			},
			openTC4(state){
				state.mackNum=3;
				state.Show4=true
			},
		//相当于同步的操作
		closeTC(state) {
			state.mackNum=0;
			state.mackNum30=0;
			// console.log(1);
			state.Show=false
			console.log(state.Show);
		},
		closeTC1(state) {
			state.mackNum=0;
			// console.log(1);
			state.Show1=false
			// console.log(state.Show);
		},
		closeTC2(state) {
			state.mackNum=0;
			// console.log(1);
			state.Show2=false
			// console.log(state.Show);
		},
		closeTC3(state) {
			state.mackNum=0;
			// console.log(1);
			state.Show3=false
			// console.log(state.Show);
		},
		closeTC4(state) {
			state.mackNum=0;
			// console.log(1);
			state.Show4=false
			// console.log(state.Show);
		},
		changeOne(state) {
			state.num = 0;
			state.num1 = -1;
			state.num2 = -1
			// console.log(this.num);
			uni.navigateTo({
				url: '/pages/Mypage/stallOwner/stallOwner',
	
			});
		},
		changeiconmy(state){
			
				state.num = 0;
				state.num1 = -1;
				state.num2 = -1
			
		},
		changeiconzy(state){
			
				state.num = -1;
				state.num1 = 0;
				state.num2 = -1
			
		},
		changeicondzp(state){
			
			state.num = -1;
			state.num1 = -1;
			state.num2 = 0
			
		},
		changeTwo(state) {
			state.num = -1;
			state.num1 = 0;
			state.num2 = -1
			// console.log(this.num);
			// console.log(this.num1);
			// console.log(this.num2);
			uni.navigateTo({
				url: '/pages/HomePage/PersonalCenter/PersonalCenter',
				
			});
		},
		changeThree(state) {
			state.num = -1;
			state.num1 = -1;
			state.num2 = 0
			// console.log(this.num2);
			uni.navigateTo({
				url: '/pages/HomePage/Largeturntable/Largeturntable',
			});
		}
	},
    actions: {
		//相当于异步的操作,不能直接改变state的值，只能通过触发mutations的方法才能改变
	}
})
export default store
